package com.hong.chapter6;

/**
 * 通过守护线程计算从开始到结束用了多少时间
 */
public class ThreadCloseForce {
    public static void main(String[] args) {
        ThreadService threadService = new ThreadService();
        long start = System.currentTimeMillis();
        threadService.execute(()->{
            try {
                Thread.sleep(5000);
            }catch (Exception e){
                e.printStackTrace();
            }
        });
        threadService.shutdown(10000);
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }

}
